package com.tour.controller.backend;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.tour.common.ServerResponse;
import com.tour.pojo.EasyUIDataGridResult;
import com.tour.service.IUserService;

/**
 * Created by fivedeath
 */
@Controller
@RequestMapping("/manage/user/")
public class UserManageController {

	@Resource
	private IUserService iUserService;

	@RequestMapping("list.do")
	@ResponseBody
	public EasyUIDataGridResult getUserList(HttpSession session,
			@RequestParam(value = "page", defaultValue = "1") int page,
			@RequestParam(value = "rows", defaultValue = "10") int rows) {
		// 填充业务
		return iUserService.getUserList(page, rows);
	}
	
	 //解冻
    @RequestMapping("unfreeze")
    @ResponseBody
    public ServerResponse unfreeze(Integer id){
		return iUserService.setStatus(id, false);
    }
    
    //冻结
    @RequestMapping("freeze")
    @ResponseBody
    public ServerResponse freeze(Integer id){
    	return iUserService.setStatus(id, true);
    }
}
